<!----引入微信JS SDK--->
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
    //编写分享代码
    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '<%= appId %>', // 必填，公众号的唯一标识
        timestamp: '<%= timestamp %>', // 必填，生成签名的时间戳
        nonceStr: '<%= nonceStr %>', // 必填，生成签名的随机串
        signature: '<%= signature %>',// 必填，签名，见附录1
        jsApiList: [
            'checkJsApi',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ'
        ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });

    wx.ready(function(){
        // alert('dddd');
        // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
        var sdata = {
            title: '<%=nickname%>正在参与果然100集元宵活动，快来一起玩吧!',
            desc: '集齐6种口味元宵即可平分10万大奖，还有海量奖品等你来拿',
            link: '<%=url%>/lantern/index',
            imgUrl: 'http://7d9nlm.com1.z0.glb.clouddn.com/guoran_ico.jpg',
            success: function () {　
            },
            cancel: function () {
　　             // alert('用户取消分享后执行的回调函数');
            }
        };
        wx.onMenuShareTimeline(sdata);
        wx.onMenuShareAppMessage(sdata);
    });

    wx.checkJsApi({
        jsApiList: ['onMenuShareTimeline'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
        success: function(res) {
            // 以键值对的形式返回，可用的api值true，不可用为false
            // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}

        }
    });
</script>
<% layout('lanternlayout') -%><!--加载全局布局文件-->
<% block('head').append('<script src="http://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>') %>

<div  ng-controller="LanternResult" >
<!---游戏DIV-->
<div class="div-relative">
    <img src="/images/activity/lantern/backgroudimg_1.png" style="width: 100%">
    <div class="div-a" ng-class="{true:'animated shake'}[shake]"><img src="/images/activity/lantern/gamewan.png" style="width: 80%" ng-click="playlao()"></div>
    <div class="div-b"><img src="/images/activity/lantern/gameszi.png" style="width: 100%" ng-click="playlao()"></div>
</div>
<!------显示有多少人集齐了---->
<div class="huojiantext"  style="color: yellow">
    <div class="zhufuyutip">广告：{{reward.advertisement}}</div>
    <div class="time"><span id="tiptext"></span>
        <span id="t_d" class="hidden">00天</span>
        <span id="t_h">00时</span>
        <span id="t_m">00分</span>
        <span id="t_s">00秒</span>
    </div><!--倒计时模块-->
    当前有<%=data.count%>人集齐6种口味的元宵
</div>
    <table class="table2">
        <tr  valign="top">
            <td width="50%" >
                <a href="http://wxshop.guoran100.com/detail/903"><img style="width: 100%" src="/images/activity/lantern/zhnqx.png"></a>
            </td>
            <td width="50%">
                <a href="http://wxshop.guoran100.com/detail/902"><img style="width: 100%" src="/images/activity/lantern/zhnpl.png"></a>
            </td>
        </tr>
    </table>
<!---内容-->
<img src="/images/activity/lantern/backgroudimg_2.png" style="width: 100%">
<div style="text-align: center">
    <img src="/images/activity/lantern/yuanxiaoyouhui.png" style="width: 90%;">
</div>

<div id="context">
    <div id="chatarea" data-ng-init="load(<%=data.card%>,<%=data.isFirst%>)">
       <table class="table1">
           <tr  valign="top">
               <td width="33%" >
                   <span class="yuanxiaonumber" ng-class="{true:'hidden'}[cardStatus.lan1]"  ng-bind="card.lan1.number"></span>
                   <img src="/images/activity/lantern/_01.png" ng-class="{true:'gray'}[cardStatus.lan1]" >
                   <br/>
                   <a href="/extra/lantern/seek/{{card.lan1.reward}}/{{card.lan1.reward_name}}">
                       <img src="/images/activity/lantern/btn_yao.png"  ng-class="{false:'hidden'}[cardStatus.lan1]" >
                   </a>
                   <!--ng-click="giveCard(event,card.lan1.reward)"-->
                   <a href="/extra/lantern/give/{{card.lan1.reward}}/{{card.lan1.reward_name}}">
                       <img src="/images/activity/lantern/btn_song.png"  ng-class="{true:'hidden'}[cardStatus.lan1]" >
                   </a>
                   <!--<img src="/images/activity/lantern/btn_yao.png"  ng-class="{false:'hidden'}[cardStatus.lan1]" >-->

                   <!--<img src="/images/activity/lantern/btn_yao.png" ng-class="{false:'hidden'}[cardStatus.lan1]" >
                   <a href="/extra/lantern/song">
                       <img src="/images/activity/lantern/btn_song.png" ng-class="{true:'hidden'}[cardStatus.lan1]" >
                   </a>-->
               </td>
               <td width="33%">
                   <span class="yuanxiaonumber" ng-class="{true:'hidden'}[cardStatus.lan2]" ng-bind="card.lan2.number"></span>
                   <img src="/images/activity/lantern/_02.png"  ng-class="{true:'gray'}[cardStatus.lan2]" >
                   <br/>
                   <a href="/extra/lantern/seek/{{card.lan2.reward}}/{{card.lan2.reward_name}}">
                       <img src="/images/activity/lantern/btn_yao.png"  ng-class="{false:'hidden'}[cardStatus.lan2]" >
                   </a>
                   <a href="/extra/lantern/give/{{card.lan2.reward}}/{{card.lan2.reward_name}}">
                       <img src="/images/activity/lantern/btn_song.png"  ng-class="{true:'hidden'}[cardStatus.lan2]" >
                   </a>
               </td>
               <td width="33%">
                   <span class="yuanxiaonumber" ng-class="{true:'hidden'}[cardStatus.lan3]" ng-bind="card.lan3.number"> </span>
                   <img src="/images/activity/lantern/_03.png" ng-class="{true:'gray'}[cardStatus.lan3]" >
                   <br/>
                   <a href="/extra/lantern/seek/{{card.lan3.reward}}/{{card.lan3.reward_name}}">
                       <img src="/images/activity/lantern/btn_yao.png"  ng-class="{false:'hidden'}[cardStatus.lan3]" >
                   </a>
                   <a href="/extra/lantern/give/{{card.lan3.reward}}/{{card.lan3.reward_name}}">
                       <img src="/images/activity/lantern/btn_song.png"  ng-class="{true:'hidden'}[cardStatus.lan3]" >
                   </a>
               </td>
           </tr>
           <tr  valign="top">
               <td width="30%">
                   <span class="yuanxiaonumber"  ng-class="{true:'hidden'}[cardStatus.lan4]" ng-bind="card.lan4.number"> </span>
                   <img src="/images/activity/lantern/_04.png"  ng-class="{true:'gray'}[cardStatus.lan4]" >
                   <br/>
                   <a href="/extra/lantern/seek/{{card.lan4.reward}}/{{card.lan4.reward_name}}">
                       <img src="/images/activity/lantern/btn_yao.png"  ng-class="{false:'hidden'}[cardStatus.lan4]" >
                   </a>
                   <a href="/extra/lantern/give/{{card.lan4.reward}}/{{card.lan4.reward_name}}">
                       <img src="/images/activity/lantern/btn_song.png"  ng-class="{true:'hidden'}[cardStatus.lan4]" >
                   </a>
               </td>
               <td width="30%">
                   <span class="yuanxiaonumber" ng-class="{true:'hidden'}[cardStatus.lan5]"  ng-bind="card.lan5.number"> </span>
                   <img src="/images/activity/lantern/_05.png"  ng-class="{true:'gray'}[cardStatus.lan5]" >
                   <br/>
                   <a href="/extra/lantern/seek/{{card.lan5.reward}}/{{card.lan5.reward_name}}">
                       <img src="/images/activity/lantern/btn_yao.png"  ng-class="{false:'hidden'}[cardStatus.lan5]" >
                   </a>
                   <a href="/extra/lantern/give/{{card.lan5.reward}}/{{card.lan5.reward_name}}">
                       <img src="/images/activity/lantern/btn_song.png"  ng-class="{true:'hidden'}[cardStatus.lan5]" >
                   </a>
               </td>
               <td width="30%">
                   <span class="yuanxiaonumber" ng-class="{true:'hidden'}[cardStatus.lan6]"  ng-bind="card.lan6.number"> </span>
                   <img src="/images/activity/lantern/_06.png" ng-class="{true:'gray'}[cardStatus.lan6]" >
                   <br/>
                   <a href="/extra/lantern/seek/{{card.lan6.reward}}/{{card.lan6.reward_name}}">
                       <img src="/images/activity/lantern/btn_yao.png"  ng-class="{false:'hidden'}[cardStatus.lan6]" >
                   </a>
                   <a href="/extra/lantern/give/{{card.lan6.reward}}/{{card.lan6.reward_name}}">
                       <img src="/images/activity/lantern/btn_song.png"  ng-class="{true:'hidden'}[cardStatus.lan6]" >
                   </a>
               </td>
           </tr>
       </table>
    </div>
</div>
<audio id="audio" autoplay="autoplay" loop="loop" preload="auto" src="http://7d9nlm.com1.z0.glb.clouddn.com/JingCheng.mp3"></audio>
<!----------首次领取3个红包--------->
<div class="shareit" id="hidefirstdiv"  ng-show="isFirst.first">
    <a ng-click="get3CardRandom()">
        <img src="/images/activity/lantern/firstGive.png"
             class="scjiangpingimg"
             ng-class="{true:'animated slideInDown'}[isFirst.first]"
             >

    </a>
    </div>

<!-------捞取奖品成功---->
<div class="shareit" id="laoqudiv" ng-show="reward.jiangpin"  >
    <img ng-src="{{reward.img}}"  ng-show="true" class="jiangpingimg"  ng-class="{true:'animated slideInDown'}[true]" ng-click="hidelaoqudivBtn()">
</div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        /*$("#hidefirstdiv").show();
        $('.scjiangpingimg').show();
        $('.scjiangpingimg').addClass('animated slideInDown');*/
        document.getElementById('audio').play();
    });
    function playlao(){
        $('.div-a').addClass('animated shake').fadeOut(1000, function () {
            $('.div-a').removeClass('animated shake');
            $('.div-a').show();
        })
    }
    //调试加入后端时删除改成angurlar方式
    function hidefirstBtn(){
        $('.scjiangpingimg').removeClass('animated slideInDown');
        $('.scjiangpingimg').addClass('animated bounceOutDown').fadeOut(500,function(){
            $(this).parent().hide();
        });
    }

    function laoquBtn(){
        $('html, body').animate({scrollTop: 0}, 'slow');
        $("#laoqudiv").show();
        $('.jiangpingimg').show();
        $('.jiangpingimg').addClass('animated slideInDown');
    }
    function hidelaoqudivBtn(){
        $('.jiangpingimg').removeClass('animated slideInDown');
        $('.jiangpingimg').addClass('animated bounceOutDown').fadeOut(500,function(){
            $(this).parent().hide();
        });
    }

    var timeandtip  = {
        nexttime: "2016/02/25 12:00:00",
        tiptext: ""
    };


    //活动提示方法
    function activityTimeTip(){
        var nowDate=new Date();
        var nowDay=nowDate.getDate(); //获取今天是几号
        var nowhour=nowDate.getHours(); //获取今天的时间
        if(nowDay<26){
            switch (nowhour){
                case 10:
                    timeandtip.nexttime="2016/02/"+nowDate.getDate()+" 11:00:00";
                    timeandtip.tiptext="活动进行中，剩余"
                    break;
                case 15:
                    timeandtip.nexttime="2016/02/"+nowDate.getDate()+" 16:00:00";
                    timeandtip.tiptext="活动进行中，剩余"
                    break;
                case 20:
                    timeandtip.nexttime="2016/02/"+nowDate.getDate()+" 21:00:00";
                    timeandtip.tiptext="活动进行中，剩余"
                    break;
                default: //如果不在活动时间点则显示下一轮的时间
                    if(nowhour>20){
                        timeandtip.nexttime="2016/02/"+(nowDate.getDate()+1)+" 10:00:00";
                        timeandtip.tiptext="下一轮开启"
                    }
                    if(nowhour>15 && nowhour <20){
                        timeandtip.nexttime="2016/02/"+(nowDate.getDate())+" 20:00:00";
                        timeandtip.tiptext="下一轮开启"
                    }
                    if(nowhour>10 && nowhour <15){
                        timeandtip.nexttime="2016/02/"+(nowDate.getDate())+" 15:00:00";
                        timeandtip.tiptext="下一轮开启"
                    }
                    if(nowhour<10){
                        timeandtip.nexttime="2016/02/"+(nowDate.getDate())+" 10:00:00";
                        timeandtip.tiptext="下一轮开启"
                    }
            }
        }else{
            //26号当天只有10点一轮
            if(nowhour<10){
                timeandtip.nexttime="2016/02/"+(nowDate.getDate())+" 10:00:00";
                timeandtip.tiptext="下一轮开启"
            }
            if(nowhour===10){
                timeandtip.nexttime="2016/02/"+nowDate.getDate()+" 11:00:00";
                timeandtip.tiptext="活动进行中，剩余"
            }
            if(nowhour>10){
                timeandtip.nexttime="2016/02/"+nowDate.getDate()+" 12:00:00";
                timeandtip.tiptext="开奖倒计时"
            }
        }
    }

    function GetRTime(){
        activityTimeTip();
        $('#tiptext').html(timeandtip.tiptext);
        var EndTime= new Date(timeandtip.nexttime);
        var NowTime = new Date();
        var t =EndTime.getTime() - NowTime.getTime();
        var d=Math.floor(t/1000/60/60/24);
        var h=Math.floor(t/1000/60/60%24);
        var m=Math.floor(t/1000/60%60);
        var s=Math.floor(t/1000%60);

        document.getElementById("t_d").innerHTML = d + "天";
        document.getElementById("t_h").innerHTML = h + "时";
        document.getElementById("t_m").innerHTML = m + "分";
        document.getElementById("t_s").innerHTML = s + "秒";
    }
    setInterval(GetRTime,0);


</script>
<% block('footer').append('<script src="'+CDN+'/extra/lantern/index.js"></script>') %>

<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan style='display:none;' id='cnzz_stat_icon_1257556523'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s11.cnzz.com/stat.php%3Fid%3D1257556523' type='text/javascript'%3E%3C/script%3E"));</script>
